package com.atguigu.spring.tx.xml.controller;

import com.atguigu.spring.tx.xml.service.BookService;
import com.atguigu.spring.tx.xml.service.CheckOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @author wk
 * @create 2021-06-03 18:14
 */
@Controller
public class BookController {
    @Autowired
    private BookService bookService;
    @Autowired
    private CheckOutService checkOutService;
    public void buyBook(int bookId,int userId){
        bookService.buyBook(userId,bookId);
    }

    /**
     * 测试事务的传播行为
     * @param bookIds
     * @param userId
     */
    public void checkout(int [] bookIds,int userId){
        checkOutService.checkout(userId,bookIds);
    }
}
